
	<template>
    <div>
        <div v-if="isAgain==0"></div>
        <template >
         <el-tree :data="menuData" default-expand-all :props="defaultProps" @node-click="handleNodeClick" ></el-tree>
        </template>
    </div>
</template>

<script>
    import store from "../../store/index.js"
    import bus from '../Navi/eventBus'
  export default {
	data() {
			return {
	            getBuildListData: {
					Pager: "false",
					PageIndex: "",
                    PageSize: "",
                    ParentId:""
                },
                 defaultProps: {
          children: 'sub',
          label: 'name'
        },
            menuData:[],
            firstIndex:""
            }
    },
    props: [],
    name: 'MenuTree',
    methods: {
    handleNodeClick(e){
        debugger
         this.$router.push({path: '/buildSetting', query: {id: e.id,name:e.name,buildType:e.buildType,parentId:e.parentID}});
    },
    //获取楼层数据
			getBuildData(data) {
				let louData = [];
				this.$httpRequest.get('api/Build/GetBuildTree', "",response => {
					if(response.isSuccess) {
                        let data = response.data;
                        
                        debugger
                        this.menuData = data;
					} else {
					}
				})
			},
    },
    //初始化的时候获取全部楼层的数据
   	 mounted(){
            debugger
       this.getBuildData();
       var that = this;
      },
      computed:{
           isAgain(){
               debugger
               this.getBuildData();
               return this.$store.getters.isShowAgain
           }
      },
      created(){
            this.bus.$on("treeBuildData",function(res){
        debugger
        this.menuData = [];
        that.menuData = res;
    })
      }
  }
</script>

